<!DOCTYPE HTML>
<?php 
	date_default_timezone_set('America/Bogota');  
	session_start();
?>
<html>
<head>
<meta charset="utf-8">
<title>Tratamiento</title>
</head>
<script language="javascript" type="text/javascript">
    function alCargar() {
        document.getElementById("camposnuevos").style.display = "none";
        document.getElementById("btncancelar").style.display = "none";
        document.getElementById("btnguardar").style.display = "none";
    }
    
    function nuevaEntrada() {
        document.getElementById("camposnuevos").style.display = "block";
        document.getElementById("btncancelar").style.display = "block";
        document.getElementById("btnguardar").style.display = "block";
        document.getElementById("btnnuevo").disabled = true;
        document.getElementById("btnvolver").disabled = true;
        document.getElementById("fecha").required = true;
        document.getElementById("desc").required = true;
    }
    
    function cancelar() {
        document.getElementById("camposnuevos").style.display = "none";
        document.getElementById("btncancelar").style.display = "none";
        document.getElementById("btnguardar").style.display = "none";
        document.getElementById("btnnuevo").disabled = false;
        document.getElementById("btnvolver").disabled = false;
        document.getElementById("fecha").required = false;
        document.getElementById("desc").required = false;
    }
	function imprimir(nit,nombre,tratamiento){
		
		var nit = <?php echo json_encode($_SESSION['consNit']); ?>;
		var nombre = <?php echo json_encode($_SESSION['conNombre']); ?>;
		var tratamiento = <?php echo json_encode($_SESSION['conTrata']); ?>;
		
		window.open('../formularios/FormularioConsentimiento.php?consNit='+nit+'&conNombre='+nombre+'&conTrata='+tratamiento, '_blank');
		window.focus();
	}
</script>
<body onLoad="alCargar();">
<form method="post" name="formulario" action="../events/EventEvoTratamiento.php">
<div align="center">
    <h1>Evoluci&oacute;n del Tratamiento</h1>
        <table style="width:500px">
            <tr>
            <td align="center"><input type="submit" id="btnvolver" name="btnvolver" value="Volver"></td>
            <td align="center"><input type="button" id="btnnuevo" name="btnnuevo" value="Nuevo" onclick="nuevaEntrada();"></td>
            <td align="center"><input type="submit" id="btnguardar" name="btnguardar" value="Guardar"></td>
            <td align="center"><input type="button" id="btncancelar" name="btncancelar" value="Cancelar" onclick="cancelar();"></td>
            <td align="center"><input type="button" id="btnseguir" name="btnseguir" value="Imprimir Concentimineto" onClick="imprimir();"></td>
            </tr>
        </table>
    <div style="display:block;" id="camposnuevos">
    <br></br>
    <table border="1" style="width:790px">
        <tr>
            <th>FECHA</th>
            <th>EVOLUCI&Oacute;N DEL TRATAMIENTO</th>
        </tr>
        <tr>
            <td align="center"><input type="date" name="fecha" id="fecha" value="<?php echo date("Y-m-d"); ?>" ></td>
            <td align="center"><textarea rows="2" cols="80" id="desc"></textarea></td>
        </tr>
    </table>    
    </div>
    <br></br>
    <table border="1" style="width:790px">
        <tr>
            <th>FECHA</th>
            <th>EVOLUCI&Oacute;N DEL TRATAMIENTO</th>
        </tr>
        <?php echo $_SESSION['listaTratamiento']; ?>
    </table>
</div>
</form>
</body>
</html>